-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When creating enrollment set is_active explicitly in the enrollment api call #2300
Conversation
Why?
|
If user re-enrolls their enrollment stays inactive and they can't access the course through the courseware. |
openedx/api.py
Outdated
@@ -668,6 +668,7 @@ def enroll_in_edx_course_runs( | |||
mode=mode, | |||
username=username, | |||
force_enrollment=force_enrollment, | |||
enrollment_attributes={"name": "is_active", "value": True}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think setting is_active
in enrollment_attributes
would not work. We will need to send is_active
as an independent key in the post data.
Here are some of the details behind:
If we take a look at this enrollment code in Open edX you will notice that they are getting the is_active
key right from the post data field and not the enrollment_attributes
. So, I think this change would not do the trick for us.
In my opinion here is what we would need to do:
- Allow create_student_enrollment to take an
is_active
attr which can beTrue
by default - Add
is_active
in enrollment_data - Update the usages of
create_student_enrollment
in MITx Online project as per needs.
So just adding here more clarification on the issue. The enrollment stays inactive only following a "verified" enrollment as a result of payment for the course run. If re-enroll in as audit again, then is works correctly. |
So I have been playing with the api and what I found is this: Set up:There is an existing enrollment that has Action:If I make an api ( |
67db5d8
to
f8529b0
Compare
e18d75f
to
0fff7b7
Compare
for more information, see https://pre-commit.ci
What are the relevant tickets?
Fix #2225 and #1797
Description (What does it do?)
If use enrolls, unenrolls, and enrolls again, the course run enrollment in edx should be active, otherwise the user can't access the course on edx, just like it happened for this user https://github.com/mitodl/hq/issues/4367.
On open edx
is_active = False
is equivalent to being unenrolled.How can this be tested?
Locally you can test if by enrolling in a course for an audit track, then unenrolling, then paying again. You can pay with a coupon too.
The api would get called again. This double call of create enrollment api is going to set is_active to true on repeated call.